<?php

namespace Modules\Captcha\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CaptchaRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            case "GET":
                return [
                    'username' => ['required']
                ];
            case "POST":
            case "PUT":
            case "PATCH":
                return [
                    'username' => ['required'],
                    'value' => ['required']
                ];
        }
        return [
            //
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }
}
